<extend name="Base/common"/>

<block name="body">

		<!--我要当老师 资料修改-->

		<form action="__SELF__" class="form-horizontal"  method="post">

		<div id="Beture2">

			<header><a href="javascript:;" class="back" onclick="history.go(-1)"><img src="__IMG__/images/back_03.png"/></a><eq name="teaching" value="1">学习内容</eq>

			<eq name="teaching" value="2">教学内容</eq></header>

			<div class="chose list1">

				<p><strong class="f-fl">类别</strong></p>

				<ul>

					<volist name='label' id='v'>

					<li>{$v.title}</li>

					<input type="radio" name="label" value="{$v.value}" style="display: none;" <eq name="course.label" value="$v.value"> checked="checked" </eq> >

					</volist>

					<!-- lkl做老数据统计 -->

					<input type="hidden" name="oldlabel" value="{$course.label}"/> 

					<div class="clear"></div>

				</ul>

			</div>

			<div class="chose list2">

				<p>课程名称</p>

				<ul>

					<li><input type="text" name="title" value="{$course.title}" placeholder="5个字以内">

					<!-- lkl做老数据统计 -->

					<input type="hidden" name="oldtitle" value="{$course.title}"  >

					</li>

				</ul>

				</div>

			<div class="chose list3">

				<p>时薪</p>

				<ul>

					<li>

						<input type="text" id="" name="salary" value="{$course.salary}" placeholder="10-500" onblur="if($(this).value<10 or $(this).value>500){alert('aaa')}" />

						<!-- lkl做老数据统计 -->

						<input type="hidden" id="" name="oldsalary" value="{$course.salary}" />

						<span>元/小时</span>

					</li>

				</ul>

			</div>

			<div class="chose list4">

			

			

			

				<p><?php if($_GET['teaching'] == 2){?>技能简介<?php }else{?>要求<?php }?></p>

				

				

				<div class="textEar" style="border-radius: 1rem;border: 1px solid #555;width: 90%;margin: auto;padding: 5px;height: 315px;">

				

					<textarea name="content"  id="intr" onKeyDown="checkMaxInput(this)" onKeyUp="checkMaxInput(this)" style="width: 100%;padding: 0px;height: 260px;border: 0;">{$course.content}</textarea>

					

					<div style="line-height: 35px; text-align: right;"><font align="right" id=remLen>140</font>字</div>

					<!-- lkl做老数据统计 -->

					<input type="hidden" id="" name="oldcontent" value="{$course.content}" />

					<div class="clear"></div>

				</div>

			</div>

			<input type="hidden" name="teaching" value="{$Think.get.teaching}">

 			<input type="hidden" name="id" value="{$course.id}">

			<input type="submit" id="btn" class="ajax-post" target-form="form-horizontal" value="提交"/>

		</div>

		</form>

<style>

	.list2 ul li{width: 230px;}

	#Beture2 .list2 li input{width: 230px;}

	.chose .checked{background: orange;color: white;}

</style>

<script>

	//选择标签效果

	$('.list1 li').click(function(){

		$('.list1 li').removeClass('checked');

		$(this).addClass('checked');

		$(this).next('input[type=radio]').attr('checked',true);

	});

	//默认选中

	$('input[type=radio]:checked').prev('li').addClass('checked');

</script>



	<script type="text/javascript"> 

		

			maxLen = 140;	//可以输入的最多字数

			function checkMaxInput(obj) {

				if (obj.value.length > maxLen){	//如超过了限制

					obj.value = obj.value.substring(0, maxLen);	//就去掉多余的字

					document.getElementById('remLen').innerText = '0';

					layer.alert("字数超过限制");

				}else{

					document.getElementById('remLen').innerText = maxLen - obj.value.length;//计算并显示剩余字数

				}

			}

			

			function va_length(){

				

				var text = document.getElementById("intr");

			

				document.getElementById('remLen').innerText = maxLen - text.value.length;

				

			}

			

			va_length();

		</script>

<script type="text/javascript">
        $(function () {
            //聚焦导航搜索 最底部消失
            $('#search').focus(function () {
                $('.LinkB').hide();
                $('.Fix').hide();
            });

            $('#search').blur(function () {
                $('.LinkB').show();
                $('.Fix').show();
            });
        })

        $('.jia').click(function () {
            $('.list1').hide();
            $('.jia').css('background', '#f6ce78');
            $('li[name=pid]').css('background', '#FFF');
            $('.sure').click(function () {
                users('0', '0', '0', '0', '0', '', '', '', '', '', '-1');
            });
        });

        $('li[name=pid]').click(function () {
            var v = $(this).attr('area_pid');
            var a = $(this).attr('data-title');
            $('.list1').show();
            $('.dangqian').html("当前:" + a);
            $('li[name=pid]').css('background', '#FFF');
            $(this).css('background', '#f6ce78');
            $('.jia').css('background', '#FFF');
            $.ajax({
                url: '{:U('area / areaList')}',
                type: 'POST',
                dataType: 'json',
                data: {id: v},
                success: function (data) {
                    var content = "<li class='' area_id=''>全城</li>";
                    $.each(data, function (name, value) {
                        content += "<li area_id='" + value.id + "'>" + value.title + "</li>"
                    });
                    content += "<div class='clear'></div>";
                    $('#area_list').html("");
                    $('#area_list').append(content);
                }
            })
        });

        $('li[name=pid]').click(function () {
            $(document).scrollTop(0);
            var va = $(this).attr('area_pid');
            $('#area_list').on('click', 'li', function () {
                var vs = $(this).attr('area_id');
                $('#area_list').find('li').removeClass('moren');
                $(this).addClass('moren');
                $('.sure').click(function () {
                    users('0', '0', '0', '0', '0', va, vs, '', '', '', '-1');
                });
            });
            $('.sure').click(function () {
                users('0', '0', '0', '0', '0', va, '', '', '', '', '-1');
            });
        });

        function qq_position()
        {
            console.log('开始定位！');
            var geolocation = new qq.maps.Geolocation("OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77", "myapp");
            if(geolocation){
                    var options = {timeout: 8000};
                    geolocation.getLocation(showPosition, showErr, options);
                    console.log('尝试加载定位');
            }else{
                    alert("定位尚未加载");
            }
        }

        function showErr(err) 
        {
            //alert("定位出现错误");
        }

        function SetCookie(name,value)
        { 
            var Days = 30;
            var exp = new Date(); 
            exp.setTime(exp.getTime() + 60*1000); 
            document.cookie = name + "=" + escape (value) +  ";expires=" + exp.toGMTString(); 
        }

        /*获取Cookie*/    
        function getCookie(cookie_name)
        {
            var allcookies = document.cookie;
            var cookie_pos = allcookies.indexOf(cookie_name);   //索引的长度
          
            // 如果找到了索引，就代表cookie存在，
            // 反之，就说明不存在。
            if (cookie_pos != -1)
            {
                // 把cookie_pos放在值的开始，只要给值加1即可。
                cookie_pos += cookie_name.length + 1;      //这里容易出问题，所以请大家参考的时候自己好好研究一下
                var cookie_end = allcookies.indexOf(";", cookie_pos);
          
                if (cookie_end == -1)
                {
                    cookie_end = allcookies.length;
                }
          
                var value = unescape(allcookies.substring(cookie_pos, cookie_end));         //这里就可以得到你想要的cookie的值了。。。
            }
            return value;
        }  

        function showPosition(positions) 
        {
            var lat = positions.lat;
            var lng = positions.lng;
            var city = encodeURI(positions.city);
            var province = encodeURI(positions.province);
            var district = encodeURI(positions.district);     
            SetCookie('lat',lat);
            SetCookie('lng',lng); 
            SetCookie('province',province);
            SetCookie('city',city);
            SetCookie('district',district);
            console.log('定位成功！！');
            //window.location.reload();
        }

        window.onload = function() {
         /*页面加载完成后执行*/
         var lat = getCookie('lat');
         if (!lat) {
            qq_position();
         }
        };
    </script>

</block>